package com.xc.sbdemo.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.Past;
import java.io.Serializable;
import java.util.Date;

@Data
@ApiModel("水果实体")
public class Fruit implements Serializable {

    // `fruitId`, `type`, `breed`, `area`, `brief`, `weight`, `price`, `dataTime`

    @ApiModelProperty("水果ID")
    @TableId(value = "fruitId",type = IdType.AUTO)
    // @TableField("fruitid")
    private int fruitId;

    @ApiModelProperty("水果类型")
    @NotEmpty(message = "类别不能为空")
    private String type;
    @NotEmpty
    private String breed;
    @NotEmpty
    private String area;
    @NotEmpty
    private String brief;
    private int weight;
    private double price;
    private String pic;

    // springmvc 数据类型转换
    // @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Past
    // @JSONField(format = "yyyy-MM-dd")
    @TableField("dataTime")
    private Date dataTime;
}
